/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * Frminscest.java
 *
 * Created on 19/02/2011, 12:18:41 AM
 */
package interfaz1;

import java.awt.Frame;
import javax.swing.JOptionPane;

/**
 *
 * @author CLIENTE
 */
public class Frminscest extends javax.swing.JFrame {

    /** Creates new form Frminscest */
    public Frminscest() {
        initComponents();
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        lblinscest = new javax.swing.JLabel();
        lblnominsest = new javax.swing.JLabel();
        lblcedinsest = new javax.swing.JLabel();
        lblapinsest = new javax.swing.JLabel();
        txtcedinsest = new javax.swing.JTextField();
        txtnominsest = new javax.swing.JTextField();
        txtapinsest = new javax.swing.JTextField();
        btnreginsest = new javax.swing.JButton();
        btncancinsest = new javax.swing.JButton();
        btnsalirinsest = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setTitle("Estudiantes");
        getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        lblinscest.setFont(new java.awt.Font("Bookman Old Style", 1, 12));
        lblinscest.setText("Inscribir Estudiante");
        getContentPane().add(lblinscest, new org.netbeans.lib.awtextra.AbsoluteConstraints(150, 40, 150, 20));

        lblnominsest.setFont(new java.awt.Font("Bookman Old Style", 0, 11));
        lblnominsest.setText("Nombre:");
        getContentPane().add(lblnominsest, new org.netbeans.lib.awtextra.AbsoluteConstraints(60, 130, 60, 20));

        lblcedinsest.setFont(new java.awt.Font("Bookman Old Style", 0, 11));
        lblcedinsest.setText("Cedula:");
        getContentPane().add(lblcedinsest, new org.netbeans.lib.awtextra.AbsoluteConstraints(60, 90, 50, 20));

        lblapinsest.setFont(new java.awt.Font("Bookman Old Style", 0, 11));
        lblapinsest.setText("Apellido:");
        getContentPane().add(lblapinsest, new org.netbeans.lib.awtextra.AbsoluteConstraints(60, 170, 50, 20));

        txtcedinsest.setFont(new java.awt.Font("Bookman Old Style", 0, 11)); // NOI18N
        getContentPane().add(txtcedinsest, new org.netbeans.lib.awtextra.AbsoluteConstraints(150, 90, 140, -1));

        txtnominsest.setFont(new java.awt.Font("Bookman Old Style", 0, 11));
        getContentPane().add(txtnominsest, new org.netbeans.lib.awtextra.AbsoluteConstraints(150, 130, 140, -1));

        txtapinsest.setFont(new java.awt.Font("Bookman Old Style", 0, 11));
        getContentPane().add(txtapinsest, new org.netbeans.lib.awtextra.AbsoluteConstraints(150, 170, 140, -1));

        btnreginsest.setText("Registrar");
        btnreginsest.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnreginsestActionPerformed(evt);
            }
        });
        getContentPane().add(btnreginsest, new org.netbeans.lib.awtextra.AbsoluteConstraints(60, 240, -1, -1));

        btncancinsest.setText("Cancelar");
        btncancinsest.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btncancinsestActionPerformed(evt);
            }
        });
        getContentPane().add(btncancinsest, new org.netbeans.lib.awtextra.AbsoluteConstraints(180, 240, -1, -1));

        btnsalirinsest.setText("Salir");
        btnsalirinsest.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnsalirinsestActionPerformed(evt);
            }
        });
        getContentPane().add(btnsalirinsest, new org.netbeans.lib.awtextra.AbsoluteConstraints(293, 240, 70, -1));

        java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
        setBounds((screenSize.width-416)/2, (screenSize.height-336)/2, 416, 336);
    }// </editor-fold>//GEN-END:initComponents

    private void btnsalirinsestActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnsalirinsestActionPerformed
        // TODO add your handling code here:
        FrmOperacionesseccion frmopsec = new FrmOperacionesseccion();
        frmopsec.show();
        dispose();
    }//GEN-LAST:event_btnsalirinsestActionPerformed

    private void btnreginsestActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnreginsestActionPerformed
        // TODO add your handling code here:



       
            if (!txtapinsest.getText().isEmpty() && !txtcedinsest.getText().isEmpty() && !txtnominsest.getText().isEmpty()) {
                Estudiante e= new Estudiante(txtcedinsest.getText(), txtnominsest.getText(), txtapinsest.getText(), 0, 0, 0, 0, "");
                FrmOperacionesseccion.getMiseccion().InscribirEstudiante(e);
                FrmOperacionesseccion.setEncon1(true);
                txtapinsest.setText("");
                txtcedinsest.setText("");
                txtnominsest.setText("");
                JOptionPane.showMessageDialog(new Frame(), "Estudiante registrado", "Aviso", JOptionPane.PLAIN_MESSAGE);

            } else {
                JOptionPane.showMessageDialog(new Frame(), "Faltan campos para registrar", "Aviso", JOptionPane.PLAIN_MESSAGE);
            }
        
    }//GEN-LAST:event_btnreginsestActionPerformed

    private void btncancinsestActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btncancinsestActionPerformed
        // TODO add your handling code here:
        txtapinsest.setText("");
        txtcedinsest.setText("");
        txtnominsest.setText("");
    }//GEN-LAST:event_btncancinsestActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
                new Frminscest().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btncancinsest;
    private javax.swing.JButton btnreginsest;
    private javax.swing.JButton btnsalirinsest;
    private javax.swing.JLabel lblapinsest;
    private javax.swing.JLabel lblcedinsest;
    private javax.swing.JLabel lblinscest;
    private javax.swing.JLabel lblnominsest;
    private javax.swing.JTextField txtapinsest;
    private javax.swing.JTextField txtcedinsest;
    private javax.swing.JTextField txtnominsest;
    // End of variables declaration//GEN-END:variables
}
